import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ConstrainedWidget extends StatelessWidget {
  ConstrainedWidget({
    Key ? key,
    @required this.text,
  }) : super(key: key);

  final String ?text;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(
        title: Text(text??""),
      ),
      body: Container(
        padding: EdgeInsets.all(15),
        child: Column(
          children: [
            ConstrainedBox(
              constraints: BoxConstraints(
                minWidth: double.infinity,
                minHeight: 50,
              ),
              child: DecoratedBox(
                decoration: BoxDecoration(color: Colors.red),
                child: Text(
                  "DecoratedBox",
                  textAlign: TextAlign.center,
                ),
              ),
            ),
            SizedBox(
              height: 60,
            ),
            SizedBox(
                height: 60,
                width: 180,
                child: DecoratedBox(
                  decoration: BoxDecoration(color: Colors.red),
                ))
          ],
        ),
      ),
    );
  }
}
